/*
Copyright [2023] [fuwen_soft]
*/
package vip.xiaonuo.modular.xylogytemplate.controller;

import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.xylogytemplate.param.XyLogyTemplateParam;
import vip.xiaonuo.modular.xylogytemplate.service.XyLogyTemplateService;
import vip.xiaonuo.modular.xylogytemplate.entity.XyLogyTemplate;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.core.annotion.version.AdminVersionSwagger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.List;
import vip.xiaonuo.sys.core.msg.Result;
import static vip.xiaonuo.sys.core.msg.ResultUtils.success;
/**
 * 谱书模板控制器
 *
 * @author yanwei
 * @date 2023-05-05 15:44:28
 */
@RestController
@Api(tags = "后台管理 谱书模板 相关APIS")
@AdminVersionSwagger
public class XyLogyTemplateController {

    @Resource
    private XyLogyTemplateService xyLogyTemplateService;

    /**
     * 查询谱书模板
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogyTemplate/page")
    @BusinessLog(title = "谱书模板_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("谱书模板_查询")
    public Result<PageResult<XyLogyTemplate>> page(XyLogyTemplateParam xyLogyTemplateParam) {
        PageResult<XyLogyTemplate> page = xyLogyTemplateService.page(xyLogyTemplateParam);
        return success(page);
    }

    /**
     * 添加谱书模板
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyLogyTemplate/add")
    @BusinessLog(title = "谱书模板_增加", opType = LogAnnotionOpTypeEnum.ADD)
    @ApiOperation("谱书模板_增加")
    public Result add(@RequestBody @Validated(XyLogyTemplateParam.add.class) XyLogyTemplateParam xyLogyTemplateParam) {
            xyLogyTemplateService.add(xyLogyTemplateParam);
        return success();
    }

    /**
     * 删除谱书模板，可批量删除
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyLogyTemplate/delete")
    @BusinessLog(title = "谱书模板_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    @ApiOperation("谱书模板_删除")
    public Result delete(@RequestBody @Validated(XyLogyTemplateParam.delete.class) List<XyLogyTemplateParam> xyLogyTemplateParamList) {
            xyLogyTemplateService.delete(xyLogyTemplateParamList);
        return success();
    }

    /**
     * 编辑谱书模板
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyLogyTemplate/edit")
    @BusinessLog(title = "谱书模板_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    @ApiOperation("谱书模板_编辑")
    public Result edit(@RequestBody @Validated(XyLogyTemplateParam.edit.class) XyLogyTemplateParam xyLogyTemplateParam) {
            xyLogyTemplateService.edit(xyLogyTemplateParam);
        return success();
    }

    /**
     * 查看谱书模板
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogyTemplate/detail")
    @BusinessLog(title = "谱书模板_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    @ApiOperation("谱书模板_查看")
    public Result<XyLogyTemplate> detail(@Validated(XyLogyTemplateParam.detail.class) XyLogyTemplateParam xyLogyTemplateParam) {
        XyLogyTemplate detail =   xyLogyTemplateService.detail(xyLogyTemplateParam);
        return success(detail);
    }

    /**
     * 谱书模板列表
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogyTemplate/list")
    @BusinessLog(title = "谱书模板_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("谱书模板_列表")
    public Result<List<XyLogyTemplate>> list(XyLogyTemplateParam xyLogyTemplateParam) {
        List<XyLogyTemplate> list  =   xyLogyTemplateService.list(xyLogyTemplateParam);
        return success(list);
    }

    /**
     * 导出系统用户
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogyTemplate/export")
    @BusinessLog(title = "谱书模板_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
    @ApiOperation("谱书模板_导出")
    public void export(XyLogyTemplateParam xyLogyTemplateParam) {
        xyLogyTemplateService.export(xyLogyTemplateParam);
    }

}
